# -*- coding: utf-8 -*-
# @Time    : 2020/2/6 15:59
# @Author  : Weymouth
# @Email   : 261229090@qq.com
# @File    : 内置函数.py
# @Software: PyCharm
# ---------------------------------------------------

#filter 过滤
# str = ['a', 'b', 'c', 'd']
#
# def fun1(s):
#     if s != 'a':
#         return s
# ret = filter(fun1, str)     #('b','c','d')
# print(ret)  #<filter object at 0x000001C972A513C8>
# print(list(ret))       # ret是一个迭代器对象

#map 修改处理
# str = ['1', '2', 'c', 'd']
#
# def fun2(s):
#     return s + "alvin"
# ret = map(fun2, str)
# print(ret)      #map object的迭代器<map object at 0x000001BE85211408>
# print(list(ret))    #['1alvin', '2alvin', 'calvin', 'dalvin']

#reduce
# from functools import reduce
#
# def add1(x, y):
#     return x + y
# print(reduce(add1, range(1, 101)))    #reduce结果就是一个值

#lambda
lambda x, y: x*y